﻿package beautifulWorld2D.engine.bo 
{
	import beautifulWorld2D.engine.interfaces.INiveau;
	import flash.display.MovieClip;
	import flash.geom.Point;
	
	public class MemoryNiveau 
	{
		private var _niveau:INiveau;
		private var _xmlData:XML;
		
		private var _positionPerso:Point;
		
		
		public function get positionPerso():Point
		{
			return _positionPerso;
		}
		public function set positionPerso(val:Point)
		{
			_positionPerso = val;
		}
		
		
		public function MemoryNiveau() 
		{

		}
		public function init(niveau:INiveau) 
		{
			_niveau = niveau;
		}
		public function apply():void
		{
			//position personnage
			_niveau.perso.x = _positionPerso.x;
			_niveau.perso.y = _positionPerso.y;
			
		}
		public function getDataXML():XML
		{

			_xmlData = new XML('<data><perso x="' + _niveau.perso.x + '" y="' + _niveau.perso.y + '" /></data>');
			
			return _xmlData;
		}
		public function setDataXML(xml:XML):void
		{
			_xmlData = xml;
			_positionPerso = new Point(parseInt(_xmlData.perso.@x), parseInt(_xmlData.perso.@y));
		}
	}
	
}